<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>银行系统登录</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <style>
        body {
            background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
            height: 100vh;
            display: flex;
            align-items: center;
        }
        
        .login-container {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            overflow: hidden;
            max-width: 450px;
        }
        
        .login-header {
            background: #1a2a6c;
            color: white;
            padding: 25px;
            text-align: center;
            position: relative;
        }
        
        .bank-logo {
            font-size: 2.5rem;
            margin-bottom: 15px;
            color: #fdbb2d;
        }
        
        .login-body {
            padding: 30px;
        }
        
        .form-control:focus {
            border-color: #1a2a6c;
            box-shadow: 0 0 0 0.25rem rgba(26, 42, 108, 0.25);
        }
        
        .btn-login {
            background: #1a2a6c;
            color: white;
            font-weight: bold;
            padding: 12px;
            transition: all 0.3s;
        }
        
        .btn-login:hover {
            background: #0d1a4a;
            transform: translateY(-2px);
        }
        
        .role-selector {
            display: flex;
            justify-content: center;
            margin-bottom: 20px;
        }
        
        .role-option {
            padding: 12px 20px;
            border: 2px solid #dee2e6;
            cursor: pointer;
            transition: all 0.3s;
            text-align: center;
            flex: 1;
            font-weight: 500;
        }
        
        .role-option:first-child {
            border-radius: 5px 0 0 5px;
        }
        
        .role-option:last-child {
            border-radius: 0 5px 5px 0;
        }
        
        .role-option.active {
            background: #1a2a6c;
            color: white;
            border-color: #1a2a6c;
        }
        
        .security-tip {
            font-size: 0.8rem;
            color: #6c757d;
            text-align: center;
            margin-top: 20px;
        }
        
        .bank-name {
            font-size: 1.8rem;
            font-weight: bold;
            letter-spacing: 1px;
        }
        
        .bank-slogan {
            font-size: 0.9rem;
            opacity: 0.8;
        }
        
        .footer-links {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin-top: 15px;
        }
        
        .footer-links a {
            color: #6c757d;
            text-decoration: none;
            font-size: 0.85rem;
        }
        
        .footer-links a:hover {
            color: #1a2a6c;
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8 col-lg-6">
                <div class="login-container">
                    <div class="login-header">
                        <div class="bank-logo">
                            <i class="bi bi-bank"></i>
                        </div>
                        <div class="bank-name">嘟睿银行</div>
                        <div class="bank-slogan">安全 · 便捷 · 值得信赖</div>
                    </div>
                    
                    <div class="login-body">
                        {% with messages = get_flashed_messages(with_categories=true) %}
                             {% if messages %}
                                {% for category, message in messages %}
                                    <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
                                        
                                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                                    </div>
                                    {% endfor %}
                                   {% endif %}
                                {% endwith %}
                               
                        
                        <form method="POST" action="{{ url_for('login') }}">
                            <div class="role-selector">
                                <div class="role-option active" data-role="admin">管理员</div>
                                <div class="role-option" data-role="customer">客户</div>
                            </div>
                            
                            <input type="hidden" name="role" id="roleInput" value="admin">
                            
                            <div class="mb-3" id="usernameField">
                                <label for="username" class="form-label">用户名</label>
                                <input type="text" class="form-control" id="username" name="username" required
                                       placeholder="请输入管理员账号">
                            </div>
                            
                            <div class="mb-3">
                                <label for="password" class="form-label">密码</label>
                                <input type="password" class="form-control" id="password" name="password" required
                                       placeholder="请输入登录密码">
                            </div>
                            
                            <div class="mb-3 form-check">
                                <input type="checkbox" class="form-check-input" id="remember">
                                <label class="form-check-label" for="remember">记住我</label>
                                <a href="#" class="float-end text-decoration-none">忘记密码?</a>
                            </div>
                            
                            <button type="submit" class="btn btn-login w-100 mb-3">
                                <i class="bi bi-box-arrow-in-right me-2"></i>登录系统
                            </button>
                            
                            <div class="security-tip">
                                <i class="bi bi-shield-lock"></i> 您的信息安全已加密保护
                            </div>
                        </form>
                        
                        <div class="footer-links">
                            <a href="#">用户协议</a>
                            <a href="#">隐私政策</a>
                            <a href="#">联系我们</a>
                            <a href="#">网点查询</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 角色选择功能
        document.querySelectorAll('.role-option').forEach(option => {
            option.addEventListener('click', function() {
                // 移除所有active类
                document.querySelectorAll('.role-option').forEach(el => {
                    el.classList.remove('active');
                });
                
                // 添加active到当前选项
                this.classList.add('active');
                
                // 更新隐藏字段
                document.getElementById('roleInput').value = this.dataset.role;
                
                // 更新标签和占位符
                const usernameField = document.getElementById('usernameField');
                if (this.dataset.role === 'customer') {
                    usernameField.querySelector('label').textContent = '银行卡号';
                    document.getElementById('username').placeholder = '请输入16位银行卡号';
                } else {
                    usernameField.querySelector('label').textContent = '用户名';
                    document.getElementById('username').placeholder = '请输入管理员账号';
                }
            });
        });
        
        // 自动填充测试数据（开发环境使用）
        <!-- 自动填充测试数据（开发环境使用） -->
       
         if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
                  document.getElementById('username').value = 'admin1';
                   document.getElementById('password').value = 'password1';
                }
</script>
</body>
</html>